package data_structure.offer;

import java.util.ArrayList;

public class Node {

    int value;
    Node left;
    Node right;

    public Node(int value){
        this.value = value;
    }

    public static ArrayList<Integer> printNodeTree(Node root){
        ArrayList<Integer> list=new ArrayList<Integer> ();
        list.add(root.value);
        print(root,list);
        return list;
    }

    public static void print(Node root,ArrayList<Integer>list){
        if(root==null){
            return;
        }
        if(root.left!=null){
            list.add(root.left.value);
        }

        if(root.right!=null){
            list.add(root.right.value);
        }
        print(root.left,list);
        print(root.right,list);

    }
}
